package org.vectrics.recruiter.struts.admin;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;

import org.apache.log4j.Category;
import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;
import org.vectrics.recruiter.RecruitServiceLocator;


public class RemoveJobCandidateAction extends Action {
	public static final long serialVersionUID = 53349952;
	
    private static Category log = Category.getInstance(RemoveJobCandidateAction.class);
	public static String LOCATION_PARAM = "location";

	public ActionForward execute(ActionMapping mapping,
				 ActionForm form,
				 HttpServletRequest request,
				 HttpServletResponse response)	throws JspException {
				 	
		String jobCandidateId = request.getParameter("jobCandidateId");
		if (jobCandidateId != null) {
			try {
				RecruitServiceLocator.getJobProvider().removeJobCandidate(new Long(jobCandidateId));
			}
			
			catch (Exception de) {
				log.error("DataException while removing jobCandidate", de);
				throw new JspException("DataException while removing jobCandidate", de);
			}
		}
		
		return (mapping.findForward("success"));
	}
}
